package com.uni.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;

import com.uni.db.GenericService;
import com.uni.domain.Lection;


@Controller
@RequestMapping("/lectionView.htm")
@SessionAttributes("lection")
public class LectionView {
    @Autowired
	@Qualifier("lectionService")
	private GenericService<Lection> lectionService;

	@RequestMapping(method = RequestMethod.GET)
    public String setupForm(@RequestParam("id") long id, ModelMap model) {
        Lection lection = lectionService.get(id);
        model.addAttribute("lection", lection);
        return "lectionView";
    }
}
